package com.ufida.ids.dao.impl;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.hereway.core.context.PageBean;
import com.hereway.core.dao.BaseHibernateDAO;
import com.ufida.ids.dao.IStaffDAO;
import com.ufida.ids.model.StaffModel;

@Repository("staffDAO")
public class StaffDAOImpl extends BaseHibernateDAO<StaffModel, Long> implements IStaffDAO {
	private static Logger logger = Logger.getLogger(StaffDAOImpl.class);

	@Override
	public List<StaffModel> findByOrgId(Long parentId) {
		return super.find("where orgId = " + parentId,"order by createTs desc");
	}
	
	public List findByConPaging(final String whereStr, final String orderStr, final PageBean page){
		return super.find(whereStr, orderStr, page);
	}

	public int findCountByCon(String whereStr) {
		return super.find(whereStr).size();
	}
	
	public Long add(StaffModel staffModel){
		super.save(staffModel);
		return staffModel.getStaffId();
	}
	
	public StaffModel findById(Long id){
		return super.get(id);
	}
	
	public void update(StaffModel staffModel){
		super.update(staffModel);
	}
	
	public List find(final String whereStr){
		return super.find(whereStr);
	}
	
}
